﻿using Koala.Pro.Models;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace Koala.Pro.Controls
{
    public partial class Pagination : UserControl
    {
        public static readonly DependencyProperty PagerInfoProperty = DependencyProperty.Register("PagerInfo", typeof(PagingData), typeof(Pagination), new PropertyMetadata((object)null));

        public static readonly DependencyProperty MaxPageIntervalProperty = DependencyProperty.Register("MaxPageInterval", typeof(int), typeof(Pagination), new PropertyMetadata(5));

        public static readonly DependencyProperty CountProperty = DependencyProperty.Register("Count", typeof(int), typeof(Pagination), new PropertyMetadata(0));

        public static readonly DependencyProperty PageUpdatedCommandProperty = DependencyProperty.Register("PageUpdatedCommand", typeof(ICommand), typeof(Pagination), new PropertyMetadata((object)null));

        public static readonly DependencyProperty ExportTitleProperty = DependencyProperty.Register("ExportTitle", typeof(string), typeof(Pagination), new PropertyMetadata("列表信息"));

        public static readonly DependencyProperty ExportPdfCommandProperty = DependencyProperty.Register("ExportPdfCommand", typeof(ICommand), typeof(Pagination), new PropertyMetadata(null));

        public static readonly DependencyProperty ExportExcelCommandProperty = DependencyProperty.Register("ExportExcelCommand", typeof(ICommand), typeof(Pagination), new PropertyMetadata(null));

        public PagingData PagerInfo
        {
            get
            {
                return (PagingData)GetValue(PagerInfoProperty);
            }
            set
            {
                SetValue(PagerInfoProperty, value);
            }
        }

        public int MaxPageInterval
        {
            get
            {
                return (int)GetValue(MaxPageIntervalProperty);
            }
            set
            {
                SetValue(MaxPageIntervalProperty, value);
            }
        }

        public int Count
        {
            get
            {
                return (int)GetValue(CountProperty);
            }
            set
            {
                SetValue(CountProperty, value);
            }
        }

        public ICommand PageUpdatedCommand
        {
            get
            {
                return (ICommand)GetValue(PageUpdatedCommandProperty);
            }
            set
            {
                SetValue(PageUpdatedCommandProperty, value);
            }
        }

        public string ExportTitle
        {
            get
            {
                return (string)GetValue(ExportTitleProperty);
            }
            set
            {
                SetValue(ExportTitleProperty, value);
            }
        }

        public ICommand ExportPdfCommand
        {
            get
            {
                return (ICommand)GetValue(ExportPdfCommandProperty);
            }
            set
            {
                SetValue(ExportPdfCommandProperty, value);
            }
        }

        public ICommand ExportExcelCommand
        {
            get
            {
                return (ICommand)GetValue(ExportExcelCommandProperty);
            }
            set
            {
                SetValue(ExportExcelCommandProperty, value);
            }
        }

        public Pagination()
        {
            InitializeComponent();
        }
    }
}
